	<?php

        function a(){
            define('c',1);
        }
        a();
        echo c;


        exit;
        class aa{
	        var $b = [];
        }

        $d = new aa;
        $d->b[] = 1;
        print_R($d);
        $c = clone $d;

        print_r($d->b == $c->b);

        $c->b[] = 2;

        print_r($d);
        print_r($c);


	exit;
    class pupa{
        private $instance;
        private $key;
        private $class;
        private $value;
        private $hatched;

        /**
         * pupa constructor.
         *
         * @param $ins
         * @param $key
         * @param $class
         * @param $value
         */
        public function __construct($ins, $key, $class, $value) {
            $this->instance = $ins;
            $this->key = $key;
            $this->class = $class;
            $this->value = $value;
        }

        private function hatch() {
            $ins = $this->instance;
            $key = $this->key;
            $class = $this->class;
            $value = $this->value;

            $ins->$key = new $class($value);
            return $ins->$key;
        }


        function __call($name, $arguments) {
            $item = $this->hatch();
            return call_user_func_array([$item,$name],$arguments);
        }

        function __get($name) {
            $item = $this->hatch();
            return $item->$name;
        }

        function __set($name, $value) {
            $item = $this->hatch();
            return $item->name = $value;
        }

        function __isset($name) {
            $item = $this->hatch();
            return isset($item->$name);
        }

        function __unset($name) {
            $item = $this->hatch();
            unset($item->name);
        }

        function __toString() {
            $item = $this->hatch();
            return (string)$item;
        }

        function __debugInfo() {
            $item = $this->hatch();
            $key = $this->key;
            return var_dump($item->$key);
        }

    }

    class bbbb{
        var $c = 1;
        public function __construct($q) {
            $this->abc = $q;
        }

    }

    class testpupa{
        var $test;
    }


    $testpupa = new testpupa();
    $testpupa->test = new pupa($testpupa, 'test', 'bbbb', 1);
    echo $testpupa->test->c;


    exit;

    class aparent{
        static $c = 1;
        private function test() {
            echo 123;
        }

        public function bb() {
            $this->test();
        }
    }

    class achild1 extends aparent{

        public function __construct() {
            static::$c = 2;
        }

    }

    class achild2 extends aparent {
        public function __construct() {
            static::$c = 3;
        }
    }

    $a = new achild1();
    $b = new achild2();
    print_r($a::$c);
    print_r($b::$c);
    print_r($a::$c);
    print_r($b::$c);


?>
<form action="" onsubmit="return false">
    <input type="text" name="a[0]">
    <span></span>
    <input type="text" name="b">
    <input type="text" name="c[][1]">
    <input type="text" name="c[][1]">
    <input type="text" name="c[][1]">
    <input type="submit">
</form>
<script src="//cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<script>

</script>
<script>
    $(document).on('submit','form',function () {
//        var prev = $(this).prev();
//        var sapi;
//        if(sapi = prev.attr('data-sapi')){
//            var target = sapi.split(':');
//            sapi = new RinAPI[target[0]][target[1]];

            var data = {}
            $(this).find('[name]').each(function(){
                var name = this.name;
                var indexs = name.match(/\[(.*?)\]/g);
                var key = name.match(/[^\[]+/);
                console.log(indexs);
                if(indexs&&indexs.length){
                    var last = null;
                    if(!data[key]){
                        last = data[key] = {}
                    }
                    else{
                        last = data[key]
                    }
                    for(var i = 0; i < indexs.length; i++){
                        indexs[i] = indexs[i].substring(1,indexs[i].length - 1);
                        var index;
                        if(indexs[i] == ''){
                            var count = 0;
                            for(var j in last){
                                count++;
                            }
                            index = count;
                        }
                        else{
                            index = indexs[i]
                        }

                        if(!last[index]){
                            last[index] = {}
                        }

                        if(i == indexs.length - 1){
                            last[index]  = this.value;
                        }

                        last = last[index]
                    }
                }
                else{
                    data[this.name] = this.value
                }
            });

            var flag = false;
            for(var i in data){
                var funcName = 'set' + i[0].toUpperCase() + i.substr(1);
                if(sapi[funcName]){
                    sapi[funcName](data[i]);
                    flag = true;
                }
            }
            if(!flag){
                sapi.params = data;
            }
            sapi.send();

            console.log(data)
            return false;
    })

    $('[data-sapi]').each(function() {
        var _this = $(this);
        var formElement = _this.next();
        formElement.on('submit', function () {

        });
    });
</script>
<?php

exit;
trait b{
    function c()
    {

    }
}

class test{
    use b{
        b::c as d;
    }
}

$c = new test();



?>

<form action="">

</form>
<?php
exit;
$arr = [
    'article1' => [
        'title' => 'fangzhang',
        "content" => 'chishi'
    ],

    'article2' => [
        'title' => 'wangzai',
        'content' => 'lashi'
    ]
];
//print_r($_GET);

$article_id = $_GET['page_id'];
$article_key = 'article' . $article_id;

echo $arr[$article_key]['title'];
echo '***********************';
echo $arr[$article_key]['content'];

exit;

ECHO $article_key;

echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;
echo PHP_EOL;

print_r($arr);

echo $_GET['page_id'];

exit;


function cccccc(Array $a, $b, $c)
{
    echo $b;
    echo $c;
}

cccccc(1, 2);


exit;
class testf
{

    public function __construct()
    {
        $this->a = null;
//        unset($this->a);
    }


    function __set($name, $value)
    {
        echo $name;
    }

}

$b = new testf();
$b->a;

exit;
$a = [1, 2];


function c(&$d)
{
    $d[] = 3;
    print_r($d);
    return $d;
}

c($a);
print_r($a);


exit;

trait a
{
    function b()
    {
        echo 123;
    }
}

class bb
{
    use a {
        a::b as c;
    }

    function b()
    {
//        echo 4;
//        $this->c();
    }
}

$c = new bb();
$c->b();


exit;
?>
    <script>
        var post = function () {
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function () {

            }
            xhr.open('post', 'test.php');
            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            var buffer = [];
            var data = {
                a: [
                    {
                        c: 2
                    }
                ]
            };
            xhr.send('0=1');
        }
        post();
    </script>
<?php
print_r($_GET);
print_r($_POST);
exit;
$a = function ($c = '', $b) {
    echo 123;
};

$ref = new ReflectionFunction($a);
$params = $ref->getParameters();
foreach ($params as $param) {
    print_r($param->getDefaultValue());
}


print_r($params);
exit;
$a = 1;
assert("$a == 12");
//	print_r($_REQUEST);
//	trait bbb{
//		function c() {
//
//		}
//	}
//	trait aaa{
//		use bbb;
//	}
//
//	class ccc{
//		use aaa;
//		use bbb;
//	}

exit;
spl_autoload_register(function ($class) {
    print_r($class);
});

class_exists('b');


exit;
try {
    echo 1;
} catch (Exception $e) {
}

exit;

$b = a();
echo $b;

exit;
preg_replace("~1~", "123", "1");

exit;
const ACTION_ECHO1 = 0x01;
const ACTION_ECHO2 = 0x02;
const ACTION_ECHO3 = 0x04;

function test($action)
{
    if ($action & ACTION_ECHO1) {
        ECHO 1;
    }
    if ($action & ACTION_ECHO2) {
        ECHO 2;
    }
    if ($action & ACTION_ECHO3) {
        ECHO 3;
    }
}

test(ACTION_ECHO1 | ACTION_ECHO3);

//ACTION_ECHO1 | ACTION_ECHO2 = 0X11
exit;
assert_options(ASSERT_WARNING, 1);

//创建处理函数
function my_assert_handler($file, $line, $code)
{
    echo "<hr>Assertion Failed:
        File '$file'<br />
        Line '$line'<br />
        Code '$code'<br /><hr />";
}

// 设置回调函数
//assert_options(ASSERT_CALLBACK, 'my_assert_handler');

$money = 2;
assert("$money >= 0", '金额不能小于0');